//#include <lifeconfig.h>
#include <appli_core.hpp>

#include <StVenKir.hpp>

#include <string>
/**
 * This routine returns the list of options using the
 * boost::program_options library. The data returned is typically used
 * as an argument of a Life::Application subclass.
 *
 * \return the list of options
 */
namespace StVenKir
{

inline
Life::po::options_description
makeOptions()
{
    Life::po::options_description StVenantKirchhoffoptions("StVenantKirchhoff options");
    StVenantKirchhoffoptions.add_options()
//        ("penalS", Life::po::value<double>()->default_value( 0.5 ), "penalisation speed parameter")
//        ("penalP", Life::po::value<double>()->default_value( 0.5 ), "penalisation presure parameter")
        ("entree-v", Life::po::value<double>()->default_value( 1.0 ), "vitesse d entree")
	    ("sortie-v", Life::po::value<double>()->default_value( 1.0 ), "vitesse de sortie")
        ("sortie-p", Life::po::value<double>()->default_value( 0.0 ), "pression imposee sur la sortie")
	    ("entree-p", Life::po::value<double>()->default_value( 0.0 ), "pression imposee sur l'entree")
	    ("rho", Life::po::value<double>()->default_value( 1.0 ), "masse volumique")
        ("mu", Life::po::value<double>()->default_value( 1.0 ), "reaction coefficient component")
        ("hsize", Life::po::value<double>()->default_value( 0.5 ), "first h value to start convergence")
        ("bccoeff", Life::po::value<double>()->default_value( 100.0 ), "coeff for weak Dirichlet conditions")
        ("f0", Life::po::value<double>()->default_value( 0.0 ), "f0")
        ("methode", Life::po::value<int>()->default_value( 1 ), "0 = Point Fixe, 1 = Newton")
	    ("coef-err", Life::po::value<double>()->default_value( 1e-5 ), "Coeferr")
        ("mesh", Life::po::value<std::string>()->default_value( "ola" ), "0 = stationnaire, 1 = instationnaire")
        ("dt", Life::po::value<double>()->default_value( 0.1 ), "dt")
        ("Tfinal", Life::po::value<double>()->default_value( 1.0 ), "Temps final")
        ("export", "export results(ensight, data file(1D)")
        ("export-matlab", "export matrix and vectors in matlab" )
        ;
    return StVenantKirchhoffoptions.add( Life::life_options() ) ;
}


/**
 * This routine defines some information about the application like
 * authors, version, or name of the application. The data returned is
 * typically used as an argument of a Life::Application subclass.
 *
 * \return some data about the application.
 */
inline
Life::AboutData
makeAbout()
{
    Life::AboutData about( "StVenantKirchhoff" ,
                           "StVenantKirchhoff" ,
                           "0.1",
                           "StVenantKirchhoff equation on simplices or simplex products",
                           Life::AboutData::License_GPL,
                           "Copyright (c) 2009 Universite de Grenoble 1 (Joseph Fourier)");

    about.addAuthor("Christophe Prud'homme", "developer", "christophe.prudhomme@ujf-grenoble.fr", "");
   return about;

}

} // end namespace StVenKir

int
main( int argc, char** argv )
{

    using namespace Life;
    /* assertions handling */
    Life::Assert::setLog( "SVK.assert");

    /* change parameters below */
    const int nDim = 2;
    const int nOrder = 2;

    typedef Life::StVenantKirchhoff<nDim, nOrder, Simplex> StVenantKirchhoff_type;

    typedef Application application_type;
    typedef boost::shared_ptr< application_type> application_ptrtype;

    application_ptrtype appli(new application_type(argc,
                                                   argv,
                                                   StVenKir::makeAbout(),
                                                   StVenKir::makeOptions()
                                                   ));

    /* define and run application */
    //StVenantKirchhoff_type SVK( argc, argv, StVenKir::makeAbout(), StVenKir::makeOptions() );
    StVenantKirchhoff_type SVK( appli );
    SVK.run();
}
